package com.zjweu.hkg.DAO;

import com.zjweu.hkg.POJO.HydroNode;
import com.zjweu.hkg.POJO.HydroNodeRelation;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface HydroDAO extends Neo4jRepository<HydroNode,Long> {
    @Query("MATCH (n:HydroNode) where n.name=$name RETURN n")
    HydroNode findHydroNodeByName(String name);

//    HydroNode findHydroNodeById(Long id);
    @Query("MATCH (n) " + "DETACH DELETE n")
    void clearAllNodes();

    @Query("MATCH (n)\n" +
            "WHERE n.name = $nodeName\n" +
            "RETURN id(n) AS nodeId")
    Long getIdByNodeName(String nodeName);



}
